package dao.impl;

import dao.UserClickCountDao;
import domain.BlackList;
import domain.UserClickCount;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

public class UserClickCountDaoImpl implements UserClickCountDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<UserClickCount> SelectSumClickCount(int adid) {
        String sql = "SELECT province,adid,clickCount FROM ad_stat GROUP BY province,adid HAVING adid = "+adid;
        List<UserClickCount> query = template.query(sql, new BeanPropertyRowMapper<UserClickCount>(UserClickCount.class));
        return query;
    }
}
